package a.j;

import javax.swing.*;
import java.awt.*;
import java.awt.geom.AffineTransform;
import java.awt.image.BufferedImage;
import java.awt.image.IndexColorModel;
import java.net.URL;

public class q
  extends n
  implements md.l_
{
  private Image f;
  private BufferedImage g;
  private URL h;
  private static final Component i = new JLabel();
  private static final MediaTracker j = new MediaTracker(i);
  private static final BufferedImage k = new BufferedImage(1, 1, 12);
  private static final double l = 1.0D;
  protected Object m = null;
  public static int n;
  
  public q() {}
  
  public q(URL paramURL)
  {
    a(paramURL);
  }
  
  public q(Image paramImage)
  {
    a(paramImage);
  }
  
  protected void a(ld paramld, Graphics2D paramGraphics2D, boolean paramBoolean)
  {
    boolean bool = ld.E;
    if ((this.f != null) && (paramld != null))
    {
      Object localObject = null;
      if ((bool) || (this.m != null))
      {
        localObject = paramGraphics2D.getRenderingHint(RenderingHints.KEY_INTERPOLATION);
        paramGraphics2D.setRenderingHint(RenderingHints.KEY_INTERPOLATION, this.m);
      }
      AffineTransform localAffineTransform = AffineTransform.getTranslateInstance(paramld.a(), paramld.b());
      localAffineTransform.scale(paramld.c() / this.f.getWidth(null), paramld.d() / this.f.getHeight(null));
      if (!bool)
      {
        paramGraphics2D.drawImage(this.f, localAffineTransform, null);
        if ((localObject != null) && (this.m != null))
        {
          if (bool) {
            break label150;
          }
          paramGraphics2D.setRenderingHint(RenderingHints.KEY_INTERPOLATION, localObject);
          if (!ld.D) {
            return;
          }
        }
      }
      label150:
      kg.a(paramGraphics2D, RenderingHints.KEY_INTERPOLATION);
    }
  }
  
  public void a(URL paramURL)
  {
    if (paramURL == null) {
      throw new NullPointerException("imageURL must not be null");
    }
    a(c(paramURL));
    this.h = paramURL;
  }
  
  public URL a()
  {
    return this.h;
  }
  
  public void a(Image paramImage)
  {
    c(paramImage);
    this.f = paramImage;
    this.h = null;
    if (!ld.E)
    {
      if (this.g != null) {
        this.g = null;
      }
    }
    else {
      a(true);
    }
  }
  
  public Image b()
  {
    return this.f;
  }
  
  public Object c()
  {
    return this.m;
  }
  
  public void a(Object paramObject)
  {
    this.m = paramObject;
  }
  
  private static Image c(URL paramURL)
  {
    Image localImage = Toolkit.getDefaultToolkit().createImage(paramURL);
    localImage = c(localImage);
    return localImage;
  }
  
  private static Image c(Image paramImage)
  {
    synchronized (j)
    {
      j.addImage(paramImage, 0);
      try
      {
        j.waitForID(0, 5000L);
      }
      catch (InterruptedException localInterruptedException)
      {
        a.i.n.a("INTERRUPTED while loading Image");
      }
      int i1 = j.statusID(0, false);
      j.removeImage(paramImage, 0);
      switch (i1)
      {
      case 2: 
        return null;
      case 4: 
        return null;
      }
      return paramImage;
    }
  }
  
  public boolean a(ld paramld, double paramDouble1, double paramDouble2)
  {
    boolean bool = ld.E;
    if (this.g != null)
    {
      paramDouble1 -= paramld.a();
      paramDouble2 -= paramld.b();
      paramDouble1 *= this.g.getWidth() / paramld.c();
      paramDouble2 *= this.g.getHeight() / paramld.d();
      if (!bool) {
        if (paramDouble1 >= 0.0D)
        {
          if (bool) {
            break label156;
          }
          if (paramDouble2 >= 0.0D)
          {
            if (bool) {
              break label156;
            }
            if (paramDouble1 < this.g.getWidth())
            {
              if (bool) {
                break label156;
              }
              if (paramDouble2 < this.g.getHeight())
              {
                if (!bool) {
                  if ((this.g.getRGB((int)paramDouble1, (int)paramDouble2) >> 24 & 0xFF) > 127) {
                    return true;
                  }
                }
                return false;
              }
            }
          }
        }
      }
      label156:
      return false;
    }
    if (((bool) || (paramDouble1 >= paramld.y)) && ((bool) || (paramDouble1 <= paramld.y + paramld.A)) && ((bool) || (paramDouble2 >= paramld.z))) {
      if (bool) {}
    }
    return paramDouble2 <= paramld.z + paramld.B;
  }
  
  public void a(boolean paramBoolean)
  {
    boolean bool2 = ld.E;
    boolean bool1 = ld.D;
    if (!bool2)
    {
      if (!paramBoolean)
      {
        if (bool2) {
          break label35;
        }
        this.g = null;
      }
    }
    else if (!bool1) {
      return;
    }
    label35:
    if (!bool2) {
      if (this.f == null)
      {
        this.g = k;
        return;
      }
    }
    if ((bool2) || (this.g == null))
    {
      if (!bool2) {
        if ((this.f instanceof BufferedImage))
        {
          this.g = ((BufferedImage)this.f);
          if ((!bool2) && (!bool1)) {
            return;
          }
        }
      }
      int i1 = (int)(this.f.getWidth(i) * 1.0D);
      int i2 = (int)(this.f.getHeight(i) * 1.0D);
      if ((bool2) || ((i1 > 0) && (i2 > 0)))
      {
        BufferedImage localBufferedImage1 = new BufferedImage(i1, i2, 2);
        Graphics2D localGraphics2D1 = localBufferedImage1.createGraphics();
        localGraphics2D1.drawImage(this.f, AffineTransform.getScaleInstance(1.0D, 1.0D), null);
        localGraphics2D1.setComposite(AlphaComposite.getInstance(5, 1.0F));
        localGraphics2D1.setColor(new Color(128, 128, 128));
        localGraphics2D1.fillRect(0, 0, i1, i2);
        localGraphics2D1.dispose();
        Color localColor1 = new Color(128, 128, 128, 0);
        Color localColor2 = new Color(0, 0, 0, 0);
        IndexColorModel localIndexColorModel = new IndexColorModel(1, 2, new byte[] { (byte)localColor2.getRed(), (byte)localColor1.getRed() }, new byte[] { (byte)localColor2.getGreen(), (byte)localColor1.getGreen() }, new byte[] { (byte)localColor2.getBlue(), (byte)localColor1.getBlue() }, 0);
        BufferedImage localBufferedImage2 = new BufferedImage(i1, i2, 13, localIndexColorModel);
        Graphics2D localGraphics2D2 = localBufferedImage2.createGraphics();
        try
        {
          localGraphics2D2.drawImage(localBufferedImage1, 0, 0, null, null);
        }
        finally
        {
          localGraphics2D2.dispose();
        }
        this.g = localBufferedImage2;
      }
    }
  }
  
  static
  {
    k.setRGB(0, 0, Color.black.getRGB());
  }
}



/* Location:           E:\idea\

 * Qualified Name:     a.j.q

 * JD-Core Version:    0.7.0.1

 */